// Table 4: Horizontal Dynasties and Night Lights //

clear all
cap log close

global path ""
use "$path/Main.dta", clear
cd "$path/"

rdbwselect_2014 log_DMSP_AVP_MEAN margin_rel, bwselect(CCT)
local bw_CCT = e(h_CCT)

rdbwselect_2014 log_DMSP_AVP_MEAN margin_rel, bwselect(IK)
local bw_IK = e(h_IK)

xtset idcode

* Column 1
reg log_DMSP_AVP_MEAN win, robust cluster(idcode_prov)
estadd ysumm
	
* Column 2
xi: xtreg log_DMSP_AVP_MEAN win i.year, fe robust cluster(idcode_prov)
estadd ysumm

* Column 3
reg log_DMSP_AVP_MEAN win mv_1 dmv_1, robust cluster(idcode_prov)
estadd ysumm

* Column 4
xi: xtreg log_DMSP_AVP_MEAN win mv_1 dmv_1 i.year, fe robust cluster(idcode_prov)
estadd ysumm
	
* Column 5
reg log_DMSP_AVP_MEAN win mv_1 dmv_1 mv_2 dmv_2, robust cluster(idcode_prov)
estadd ysumm

* Column 6
xi: xtreg log_DMSP_AVP_MEAN win mv_1 dmv_1 mv_2 dmv_2 i.year, fe robust cluster(idcode_prov)
estadd ysumm

* Column 7
reg log_DMSP_AVP_MEAN win if abs(margin_rel) <= `bw_CCT', robust cluster(idcode_prov)
estadd ysumm
		
* Column 8
xi: xtreg log_DMSP_AVP_MEAN win i.year if abs(margin_rel) <= `bw_CCT', fe robust cluster(idcode_prov)
estadd ysumm

* Column 9
reg log_DMSP_AVP_MEAN win if abs(margin_rel) <= `bw_IK', robust cluster(idcode_prov)
estadd ysumm
		
* Column 10
xi: xtreg log_DMSP_AVP_MEAN win i.year if abs(margin_rel) <= `bw_IK', fe robust cluster(idcode_prov)
estadd ysumm
